<?php include('scripts.php'); ?>

<script type="text/javascript" language="javascript">
var datagrid = null;
$(function() {
     datagrid = $("#datagrid").r9jasonDataTable({
        // online1DataTable extra params
        "idTr" : true, // assign <tr id='xxx'> from 1st columns array(aoColumns);
        "extraParam" : function(aoData){ // pass extra params to server
                aoData.push( { "name": "filterAction", "value": $("#search_action").val() } );
        },
        "reassignEvent" : function(){ // extra function for reassignEvent when JSON is back from server
            reassignDatagridEventAttr();
        },

        // datatables params
        "bLengthChange": true,
        "bFilter": false,
        "bProcessing": true,
        "bServerSide": true,
        "bAutoWidth": false,
        "sAjaxSource": "/finance/goldDividendLogList",
        "sPaginationType": "full_numbers",
        "aaSorting": [[0,'desc']],
        "aoColumns": [
                      { "sName" : "dividend_date", "bVisible" : true,  "bSortable": true},
                      { "sName" : "idx",  "bSortable": true},
                      { "sName" : "cps",  "bSortable": true},
                      { "sName" : "gold_price",  "bSortable": true},
                      { "sName" : "dividend_amount",  "bSortable": true},
                      { "sName" : "status_code",  "bSortable": true}
        ]
    });
}); // end function

function reassignDatagridEventAttr(){
	$("a[id=editLink]").click(function(event){

	});
}
</script>

<div style="padding: 10px; top: 30px; width: 98%">
<div class="portlet">
    <div class="portlet-header"><?php echo __('Gold Dividend Log') ?></div>
    <div class="portlet-content">
    <table class="display" id="datagrid" border="0" width="100%">
        <thead>
        <tr>
            <th><?php echo __('Dividend Date') ?></th>
            <th><?php echo __('No.') ?></th>
            <th><?php echo __('CPS') ?></th>
            <th><?php echo __('Gold Price') ?></th>
            <th><?php echo __('Dividend Amount') ?></th>
            <th><?php echo __('Status') ?></th>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td>
                <select id="search_action"  class="search_init">
                    <option value="">All</option>
                    <option value="ACTIVE">Pending</option>
                    <option value="COMPLETE">Complete</option>
                </select>
            </td>
        </tr>
        </thead>
    </table>
</div>
</div>
</div>
